#ifndef BCM_COMPONENT_CNC_COMM_CODEC_MANAGER_H
#define BCM_COMPONENT_CNC_COMM_CODEC_MANAGER_H

// required interfaces
// (empty)
// provided interfaces
#include "bcmi_keyboard.h"
#include "bcmi_ftrnsfer.h"
#include "bcmi_dnclnk.h"
#include "bcmi_pmcs.h"
#include "bcmi_taskctl.h"
// generic component
#include "codecmgr.h"
// include files
#include <bcm/bcm.h>

//#pragma warning(disable : 4250)

namespace cnc {

namespace comm {

class BCMC_CodecManager :
	public bcm::Identifier<bcm::Component>,
	protected bcm::Identifier<BCMI_Keyboard>,
	protected bcm::Identifier<BCMI_FileTransfer>,
	protected bcm::Identifier<BCMI_DNCLink>,
	protected bcm::Identifier<BCMI_PMCS>,
	protected bcm::Identifier<cnc::base::BCMI_TaskControl>,
	protected CodecManager
{
protected:
	BCMC_CodecManager(bcm::GetComponentResult *result) :
		bcm::Identifier<bcm::Component>("codecmgr", "Codec Manager"),
		bcm::Identifier<BCMI_Keyboard>("keyboard", "Keyboard"),
		bcm::Identifier<BCMI_FileTransfer>("ftrnsfer", "File Transfer"),
		bcm::Identifier<BCMI_DNCLink>("dnclnk", "DNC Link"),
		bcm::Identifier<BCMI_PMCS>("pmcs", "PMCS"),
		bcm::Identifier<cnc::base::BCMI_TaskControl>("taskctl", "Task Control")
	{
		*result = bcm::GC_OK;
	}
	virtual bcm::IdentifierData *getProvidedInterfaceTable()
	{
		static bcm::IdentifierData idData[] = {
			{ "keyboard", "Keyboard" },
			{ "ftrnsfer", "File Transfer" },
			{ "dnclnk", "DNC Link" },
			{ "pmcs", "PMCS" },
			{ "taskctl", "Task Control" },
			{ nullptr, nullptr }
		};
		return idData;
	}
	virtual bcm::IdentifierData *getRequiredInterfaceTable()
	{
		static bcm::IdentifierData idData[] = {
			{ 0, 0 }
		};
		return idData;
	}
	virtual bcm::Interface *getInterface(const char *id)
	{
		if (std::string("keyboard") == id)
			return static_cast<BCMI_Keyboard *>(this);
		if (std::string("ftrnsfer") == id)
			return static_cast<BCMI_FileTransfer *>(this);
		if (std::string("dnclnk") == id)
			return static_cast<BCMI_DNCLink *>(this);
		if (std::string("pmcs") == id)
			return static_cast<BCMI_PMCS *>(this);
		if (std::string("taskctl") == id)
			return static_cast<cnc::base::BCMI_TaskControl *>(this);
		return nullptr;
	}
	virtual bool setInterface(bcm::Interface *iface)
	{
		if (iface == nullptr)
			return false;
		return false;
	}
public:
	static BCMC_CodecManager &instance(bcm::GetComponentResult *result)
	{
		static BCMC_CodecManager object(result);
		return object;
	}
};

} // namespace comm

} // namespace cnc

#endif
